package com.lxyk.service.monthly.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lxyk.dao.monthly.JobDao;
import com.lxyk.domain.Job;
import com.lxyk.service.monthly.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @ClassName JobServiceImpl
 * @Description TODO
 * @Author FJQ
 * @Date 2022/4/10 19:37
 * @Version 1.0
 **/
@Service
public class JobServiceImpl implements JobService {

    @Autowired
    private JobDao jobDao;

    @Override
    public PageInfo<Job> QueryAll(Map map,Integer pageNum, Integer pageSize) {
        pageNum = pageNum != null ? pageNum : 1;
        pageSize = pageSize != null ? pageSize : 10;
        PageHelper.startPage(pageNum, pageSize);
        List<Job> jobs = jobDao.selectAll(map);
        return new PageInfo(jobs);
    }

    @Override
    public int saveJob(Job job) {
        return jobDao.addJob(job);
    }

    @Override
    public boolean removeJobById(Integer id) {
        return jobDao.deleteJobById(id);
    }

    @Override
    public boolean modifyJob(Job job) {
        return jobDao.updateJob(job);
    }

    @Override
    public Job QueryById(Integer id) {
        return jobDao.selectJobById(id);
    }

    @Override
    public Integer addStudentJob(Integer cid) {
        return jobDao.addStudentJob(cid);
    }


}
